#ifndef MESSAGE_H
#define MESSAGE_H

#include <QByteArray>

class Message
{
public:
	enum opType {ADD_TEXT, ADD_TABLE, ADD_IMAGE, ADD_HTML, CHANGE_FORMAT, REMOVE, SESSION_NAME, USER_INFO, DOCUMENT, CHAT, SYS, INITDOC};

	Message() {}
	Message(opType newOp);

	static opType getOpType(QByteArray & bytes);	//get the operation type, given a byte array

	virtual QByteArray toBytes() = 0;		//convert the message into a byte array

	void setOperation(opType newOp) {operation = (quint8)newOp;}
	opType getOperation() {return (opType)operation;}

protected:
	quint8 operation;
};

#endif // MESSAGE_H
